package com.qingneng.web;

import java.util.List;

import org.apache.log4j.Logger;

import com.opensymphony.xwork2.Action;
import com.qingneng.service.sdk.IWorkBudgetService;
import com.tbfs.common.BaseAction;

public class LoadBudgetItem_hfc_clAction extends BaseAction{
	
	private static final Logger logger = Logger.getLogger(LoadBudgetItemAction.class);
	
	private IWorkBudgetService workBudgetService = null;
	
	public LoadBudgetItem_hfc_clAction(){
		
	}
	
	public LoadBudgetItem_hfc_clAction(IWorkBudgetService workBudgetService){
		this.workBudgetService = workBudgetService;
	}
	
	
	//params
	private double sludgeCapacity;
	private int project_workinfo_id;
	private double wasteWaterCapacity;
	private double effectiveCapacity;
	
	
	public double getSludgeCapacity() {
		return sludgeCapacity;
	}

	public void setSludgeCapacity(double sludgeCapacity) {
		this.sludgeCapacity = sludgeCapacity;
	}

	public int getProject_workinfo_id() {
		return project_workinfo_id;
	}

	public void setProject_workinfo_id(int project_workinfo_id) {
		this.project_workinfo_id = project_workinfo_id;
	}

	public double getWasteWaterCapacity() {
		return wasteWaterCapacity;
	}

	public void setWasteWaterCapacity(double wasteWaterCapacity) {
		this.wasteWaterCapacity = wasteWaterCapacity;
	}

	public double getEffectiveCapacity() {
		return effectiveCapacity;
	}

	public void setEffectiveCapacity(double effectiveCapacity) {
		this.effectiveCapacity = effectiveCapacity;
	}


	private int parent_item_id;
	
	
	

	public int getParent_item_id() {
		return parent_item_id;
	}

	public void setParent_item_id(int parent_item_id) {
		this.parent_item_id = parent_item_id;
	}



	private List rows = null;
	


	public List getRows() {
		return rows;
	}

	public void setRows(List rows) {
		this.rows = rows;
	}

	public Integer getTotal() {
		return total;
	}

	public void setTotal(Integer total) {
		this.total = total;
	}

	private Integer total;
	
	public String execute(){
		
		if(logger.isDebugEnabled()){
			logger.debug("+++ begin execute LoadBudgetItem_hfc_clAction menthod +++ ");
		}
		
		logger.info("parent_item_id:"+parent_item_id);
		logger.info("project_workinfo_id:"+project_workinfo_id);
		logger.info("WasteWaterCapacity:"+wasteWaterCapacity);
		logger.info("SludgeCapacity:"+sludgeCapacity);
		logger.info("EffectiveCapacity:"+effectiveCapacity);
		
		/*//获取子预算项
		BudgetItem budgetItem  = new BudgetItem();
		budgetItem.setParent_item_id(parent_item_id);
		rows =  workBudgetService.getBudgetItem(budgetItem);
		if(rows!=null){
			for(int i=0;i<rows.size();i++){
				BudgetItem childItem = (BudgetItem)rows.get(i);
				if("化粪池清掏".equals(childItem.getBudget_item_value())){
					childItem.setBudget_do_quantities(String.valueOf(UtilTool.doubleFormat(effectiveCapacity)));
					double price  = new Double( childItem.getItem_unit_price()).doubleValue();
					childItem.setTotalAmount(UtilTool.doubleFormat(effectiveCapacity*price));

				}
				if("化粪池清底".equals(childItem.getBudget_item_value())){
					childItem.setBudget_do_quantities(String.valueOf(UtilTool.doubleFormat(sludgeCapacity)));
					double price  = new Double( childItem.getItem_unit_price()).doubleValue();
					childItem.setTotalAmount(UtilTool.doubleFormat(sludgeCapacity*price));
				}
			}
		}*/
		
		total = new Integer(1000000);
		
		if(logger.isDebugEnabled()){
			logger.debug("+++ end execute LoadBudgetItem_hfc_clAction menthod +++ ");
		}
		
		return Action.SUCCESS;
	}
	
	/**
	 * 计算总价格
	 * @param dj
	 * @param work_gzl
	 * @return
	 */
	public String calTotal(int dj,String work_gzl){
		Double d_total = new Double (0.000);
		if(work_gzl!=null && !"".equals(work_gzl)){
			double d_work_gzl = new Double(work_gzl);	
			d_total = new Double (dj * d_work_gzl);
		}

		return d_total.toString();	
	}
	
}
